/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package service;

import graphviewer.*;
import java.awt.*;
import javax.swing.*;

/**
 *
 * @author Sabitov Artem
 * @since 08.07.2013
 */
public class Service extends JFrame {
	private static boolean debugComponent = false;
	private static boolean serviceActive = true;
	private static boolean fullLog = true;
	
	private static ServiceLog serviceLogPanel;
	private static ServiceInfo serviceInfoPanel;
	
	public Service() {
		setLocation(GraphViewer.FRAME_WIDTH + GraphViewer.FRAME_LOCATION_X + 4, GraphViewer.FRAME_LOCATION_Y);
		setTitle("Service");
		setSize(GraphViewer.FRAME_WIDTH / 4, GraphViewer.FRAME_HEIGHT);
		getContentPane().setBackground(Color.GRAY);
		setVisible(true);
		initService();
	}
	
	private void initService() {
		Storage.setService(this);
		serviceInfoPanel = new ServiceInfo();
		serviceLogPanel = new ServiceLog(fullLog);
		
		this.add(new ServiceMouse(this));
		this.add(serviceInfoPanel);
		this.add(serviceLogPanel);
	}
	
	public void updateStateService() {
		serviceInfoPanel.update();
		serviceLogPanel.update();
	}
	
	public static boolean getServiceState() {
		return serviceActive;
	}
	public static boolean getStateDebugComponent() {
		return debugComponent;
	}
	
	public static void log(Object obj) {
		if(serviceLogPanel != null) {
			serviceLogPanel.log(obj);
		}
	}
}
